package org.mobile.api.filter;

import java.util.List;

import org.mobile.api.ApiFactory;

import com.ucmed.alias.api.validator.Validator;
import com.ucmed.api.filter.chain.FilterChain;
import com.ucmed.api.filter.chain.FilterChainFactory;
import com.ucmed.api.filter.exec.ApiExecFilter;

/**
 * @author sbwkl
 */
public class FilterChainFactoryImpl implements FilterChainFactory {

    private ApiFactory apiFactory;

    private Validator apiValidator;

    public void setApiValidator(Validator apiValidator) {
        this.apiValidator = apiValidator;
    }

    public void setApiFactory(ApiFactory apiFactory) {
        this.apiFactory = apiFactory;
    }

    @Override
    public FilterChain getFilterChain(List<ApiExecFilter> filters) {
        FilterChainImpl filterChain = new FilterChainImpl(filters);
        filterChain.setApiFactory(apiFactory);
        filterChain.setApiValidator(apiValidator);
        return filterChain;
    }

}
